<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
	<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>公告信息</title>
	<jsp:include page="../../../main/mp/inc.jsp"	/>
	 <style>
             .toolAndroid {
                   position:fixed !important;
                   bottom: -11px !important;
                   left:0px !important;
                   width:100% !important;
                   background-color:gainsboro;
               }
               .btn-txt[class='ui-btn-icon-left']{
                   padding-left: 1.6em !important;
               }

               .toolIos{
                  position:absolute !important;
                  bottom: -11px !important;
                  left:0px !important;
                  width:99% !important;
                  background-color:gainsboro;
               }
        </style>
	<script>

		$(function(){
			$("[data-role='navbar']").navbar();
			$("[data-role='header'], [data-role='footer']").toolbar();
		});
	</script>
</head>
<body>
	<!-- class="jqm-demos" -->
	<input type="hidden" id="hi_ids" value=""/>
	<div data-role="page" id="page-main">
	    <div data-role="header" data-position="fixed" data-theme="a">
		    <h1 style="float:left;margin: 0 10px;"><i class="fa fa-user"></i> 公告信息</h1>
			<a href="#" id="page-comment-action" class="ui-btn ui-btn-right ui-icon-check ui-corner-all ui-btn-icon-left">批注</a>
	    </div><!-- /header -->
        <%--<div data-role="controlgroup" data-type="horizontal" class="ui-mini ui-btn-right">--%>
            <%--<a data-icon="tag" data-ajax="false" id="reservation_cancel" href="ajax-announce!input.action?proInfoId=<s:property value="proInfo.id" />">批注</a>--%>
        <%--</div>--%>

	    <div class="ui-content jqm-content jqm-fullwidth" role="main">	
	    	<form method="post" id="announce" action="" data-ajax="false">
				<input type="hidden" name="keyId" id="keyId" value="<s:property value="announce.id" />">
				
				<div class="ui-field-contain">
				    <label>公告主题：</label>
				    <span><s:property value="announce.name" /></span>
				</div>
				<div class="ui-field-contain">
				    <label>公告内容：</label>
				    <span><s:property value="announce.content" /></span>
				</div>
				
				<div class="ui-field-contain">
				    <label>发布日期：</label>
				    <span><s:date name="announce.publishTime" format="yyyy-MM-dd"></s:date></span>
				</div>
				
				<div class="ui-field-contain">
				    <label>通知成员：</label>
				    <span >
                        <s:if test="announce.callType==0">
                            <span>全体成员</span>
                        </s:if>
                        <s:else>
                            <s:iterator value="announce.usersSet" id="list">
                                <s:property value="#list.name"></s:property>
                            </s:iterator>
                            <input type="hidden" id="userId" value="<s:iterator id="list" value="announce.usersSet"><s:property value="#list.id"/>,</s:iterator>"/>
                        </s:else>
				    </span>
				</div>
			</form>

		</div><!-- /content -->
    </div>
	<!-- 页面批注-->
	<div data-role="page" id="page-comment" data-theme="a" targetId="<s:property value="announce.id" />" targetObject="com.joint.core.entity.Announce" data="{}" createrId="<s:property value="announce.creater.id" />">
		<div data-role="header"  >
			<a href="#" key="page-main-action" data-ajax="false" id="" class="ui-btn ui-btn-left ui-icon-back ui-corner-all ui-btn-icon-left ui-btn-icon-notext">视图</a>
			<h1>批注信息</h1>
		</div><!-- /header -->
		<div role="main" class="ui-content" id="comment-listview-content"
			 mp-url="ajax-comment!listDocument.action?keyId=<s:property value="announce.id" />">
			<ul data-role="listview" data-theme="a" data-dividertheme="b"
				mp-page="1" mp-keyword="" data-split-icon="forward" data-split-theme="a" data-inset="false">
				<li><a data-ajax="false"  href="javascript:void(0)">
					没有批注信息.
				</a>
				</li>
			</ul>

			<div style="height: 40px;">

			</div>
			<div id="ToolBar">
				<table style="width:100%">
					<tr>
						<td>
							<img id="btn_choose" src="../resource/com/img/add-18.png" style="float: right;"/></a>
						</td>
						<td>
							<input type="text" placeholder="请输入内容" id="chart_user"  name="chart_user" />
						</td>
						<td>
							<img id="chart_btn" src="../resource/com/img/yes-19.png"  style="float: left"/></a>
						</td>
					</tr>
				</table>
			</div>
			<%--<div data-role="popup" id="comment-popup2" data-theme="a" class="ui-corner-all" data-history="false" data-corners="false">--%>
				<%--<a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-a ui-icon-delete ui-btn-icon-notext ui-btn-left">Close</a>--%>
				<%--<form>--%>
					<%--<div style="padding:0 8px;">--%>
						<%--<textarea cols="40" rows="8" name="comment" placeholder="请填写您的批注信息"></textarea>--%>
						<%--<button type="button" class="ui-btn ui-corner-all ui-shadow ui-btn-b ui-btn-icon-left ui-icon-check">提交批注</button>--%>
						<%--         </div>--%>
				<%--</form>--%>
			<%--</div>--%>

		</div><!-- /content -->
		<div style="height: 40px;">

		</div>
	</div><!-- /page comment -->
	<div data-role="page" id="page-user" data-theme="a">
		<div data-role="header"  >
			<a href="#page-comment" key="page-comment-action" data-ajax="false"  class="ui-btn ui-btn-left ui-icon-back ui-corner-all ui-btn-icon-left ui-btn-icon-notext">视图</a>
			<h1>请选择要回复的人</h1>
			<a id="comuser_btn" mp-panel-id="proinfo-listview-panel" href="#" class="ui-btn ui-shadow ui-mini ui-btn-right">确认</a>
			<%--<div id="search"  class="ui-field-contain" style="margin:0;padding:0;">--%>
			<%--<input type="search" name="search-mini" placeholder="按姓名搜索" id="search-mini" value="" />--%>
			<%--<a href="javascript:void(0)" id="search-button"  data-ajax="false" class="ui-btn">查询</a>--%>
			<%--</div>--%>
		</div>
		<div role="main" class="ui-content" id="comment-user-content"
			 mp-url="ajax-comment!usersPage.action">
			<div id="scroller">
				<!-- 下拉按钮 new -->
				<%--<div id="pullDown">--%>
				<%--<span class="pullDownIcon"></span> <span class="pullDownLabel">下拉松开刷新...</span>--%>
				<%--</div>--%>
				<ul data-role="listview" data-theme="a" data-dividertheme="b"
					mp-page="1" mp-keyword="" data-split-icon="forward" data-split-theme="a" data-inset="false">
					<li>
					</li>
				</ul>
				<!-- 上拉按钮 new -->
				<%--<div id="pullUp">--%>
				<%--<span class="pullUpIcon"></span><span class="pullUpLabel">上拉显示更多...</span>--%>
				<%--</div>--%>
			</div>

		</div>
	</div>

	<script type="text/javascript">
		/**批注相关JS**/
			//详情页面
		$(function(){
			$("a[key=page-main-action]").click(function(){
				$(':mobile-pagecontainer').pagecontainer('change', '#page-main',{changeHash: false,reverse: true,transition:'slideup'});
			})
			//批注页面
			$("#page-comment-action").off("click").on("click",function(){
				$(':mobile-pagecontainer').pagecontainer('change', '#page-comment',{changeHash: false,reverse: true,transition:'slidedown'});

				loadListview($("#comment-listview-content"),{},function(rdata){
					$("a[key=comment-popup2]").unbind('click').bind("click",function(e){
						$( "#comment-popup2" ).data("parentId",$(this).attr("parentId")).data("createrId",$(this).attr("createrId"));
						$( "#comment-popup2 textarea" ).attr("placeholder","@"+$(this).attr("createrName"));
						$( "#comment-popup2" ).popup( "open", {transition:'pop',positionTo:'window'} );
					})
				})
				//location.href = 'ajax-comment!view.action?targetId=<s:property value="announce.id"/>'+"&targetObject="+"com.joint.core.entity.Announce";

			})
			//发表批注对话框的提交按钮
			$("#chart_btn").bind("click",function(e){
				//alert(1);
				//隐藏popup
				var toUsersId = $( "#hi_ids").val();
				//var createrId = $( "#comment-popup2" ).data("createrId");
				var text = $( "#chart_user" ).val();

				var targetId = $("#page-comment").attr("targetId");
				var targetObject = $("#page-comment").attr("targetObject");
				//alert(parentId + " " + createrId + " " + text + " " + targetId + " " + targetObject);
				sendComment(null,toUsersId,text,targetId,targetObject,function(){
				});
			});
			$("#btn_choose").click(function(){
				$(':mobile-pagecontainer').pagecontainer('change', '#page-user',{changeHash: false,reverse: true,transition:'slideup'});
				loadListview($("#comment-user-content"),{},function(rdata){

				})
			});
		})
	</script>
	<script>
		$(function(){
			$("#comuser_btn").click(function(){
				var ids='';
				var names='';
				$("input[name='check_user']:checked").each(function(i,v){
					ids+=$(this).attr("id")+",";
					//names+="@"+$(this).attr("key")+" ";
				});
				$("#hi_ids").val(ids);
				//$("#chart_user").val(names);
				$(':mobile-pagecontainer').pagecontainer('change', '#page-comment',{changeHash: false,reverse: true,transition:'slideup'});
				var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
                if(isiOS){
                    document.body.scrollTop = 90000;

                }
			});

		});

	</script>
	<script type="text/javascript">
		$(function(){
              var u = navigator.userAgent, app = navigator.appVersion;
                var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
                var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
                $("#ToolBar").addClass("toolAndroid");
                if(isiOS){
                    $('#chart_user').focus(function(){
                          var body = $('body').height();
                          var comment_listview = $("#comment-listview-content").height();
                          if(body>comment_listview){
                            document.body.scrollTop = body;
                          }else{
                            $("#ToolBar").removeClass().addClass("toolIos");
                            document.body.scrollTop = comment_listview;
                          }

                    });
                    $('#chart_user').blur(function(){
                         $("#ToolBar").removeClass().addClass("toolAndroid");
                    });
                }
        });
	</script>

</body>
</html>